﻿'
' Quiz Module for DotNetNuke
' Project Contributors - Will Strohl (http://www.WillStrohl.com)
'
'Copyright (c) 2011, Will Strohl
'All rights reserved.
'
'Redistribution and use in source and binary forms, with or without modification, are 
'permitted provided that the following conditions are met:
'
'Redistributions of source code must retain the above copyright notice, this list of 
'conditions and the following disclaimer.
'
'Redistributions in binary form must reproduce the above copyright notice, this list 
'of conditions and the following disclaimer in the documentation and/or other 
'materials provided with the distribution.
'
'Neither the name of Quiz Module for DotNetNuke, nor the names of its contributors may be 
'used to endorse or promote products derived from this software without specific prior 
'written permission.
'
'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
'EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
'OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
'SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
'INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
'TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
'BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
'CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
'ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
'DAMAGE.
'

Imports DotNetNuke

Namespace WillStrohl.Modules.Quiz

    Public MustInherit Class DataProvider

#Region " Private Members "

        Private Const c_Object As String = "data"
        Private Const c_ObjectType As String = "WillStrohl.Modules.Quiz"

#End Region

#Region " Shared/Static Methods "

        ' singleton reference to the instantiated object 
        Private Shared objProvider As DataProvider = Nothing

        ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
        Private Shared Sub CreateProvider()
            objProvider = CType(Framework.Reflection.CreateObject(c_Object, c_ObjectType, c_ObjectType), DataProvider)
        End Sub

        ' return the provider
        Public Shared Shadows Function Instance() As DataProvider
            Return objProvider
        End Function

#End Region

#Region " Abstract Methods "

        Public MustOverride Function AddQuiz(ByVal PortalId As Integer, ByVal QuizName As String, ByVal QuizDescription As String, ByVal RandomizeQuestions As Boolean, ByVal QuestionCount As Integer, ByVal BeginDate As DateTime, ByVal EndDate As DateTime, ByVal LastModifiedBy As Integer) As Integer
        Public MustOverride Sub UpdateQuiz(ByVal QuizId As Integer, ByVal PortalId As Integer, ByVal QuizName As String, ByVal QuizDescription As String, ByVal RandomizeQuestions As Boolean, ByVal QuestionCount As Integer, ByVal BeginDate As DateTime, ByVal EndDate As DateTime, ByVal LastModifiedBy As Integer)
        Public MustOverride Sub DeleteQuiz(ByVal QuizId As Integer)
        Public MustOverride Function GetQuiz(ByVal QuizId As Integer) As IDataReader
        Public MustOverride Function GetQuizCount(ByVal PortalId As Integer) As Integer
        Public MustOverride Function GetQuizzes(ByVal PortalId As Integer) As IDataReader

        Public MustOverride Function GetQuestion(ByVal QuestionId As Integer) As IDataReader
        Public MustOverride Function GetQuestionCount(ByVal QuizId As Integer) As Integer
        Public MustOverride Function GetQuestions(ByVal QuizId As Integer) As IDataReader
        Public MustOverride Function AddQuestion(ByVal QuizId As Integer, ByVal Question As String, ByVal QuestionType As String, ByVal RandomizeAnswers As Boolean, ByVal IsActive As Boolean, ByVal DisplayOrder As Integer, ByVal LastModifiedBy As Integer) As Integer
        Public MustOverride Sub UpdateQuestion(ByVal QuestionId As Integer, ByVal QuizId As Integer, ByVal Question As String, ByVal QuestionType As String, ByVal RandomizeAnswers As Boolean, ByVal IsActive As Boolean, ByVal DisplayOrder As Integer, ByVal LastModifiedBy As Integer)
        Public MustOverride Sub DeleteQuestion(ByVal QuestionId As Integer)

        Public MustOverride Function GetAnswer(ByVal AnswerId As Integer) As IDataReader
        Public MustOverride Function GetAnswers(ByVal QuestionId As Integer) As IDataReader
        Public MustOverride Function AddAnswer(ByVal QuestionId As Integer, ByVal Answer As String, ByVal IsCorrect As Boolean, ByVal IsActive As Boolean, ByVal DisplayOrder As Integer, ByVal LastModifiedBy As Integer) As Integer
        Public MustOverride Sub UpdateAnswer(ByVal AnswerId As Integer, ByVal QuestionId As Integer, ByVal Answer As String, ByVal IsCorrect As Boolean, ByVal IsActive As Boolean, ByVal DisplayOrder As Integer, ByVal LastModifiedBy As Integer)
        Public MustOverride Sub DeleteAnswer(ByVal AnswerId As Integer)

#End Region

    End Class

End Namespace